home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Freeware 2001 May
/
SGI Freeware 2001 May - Disc 2.iso
/
dist
/
fw_cdlabelgen.idb
/
usr
/
freeware
/
share
/
cdlabelgen
/
template.ps.z
/
template.ps
Wrap
Text File
|
1999-10-18
|
19KB
|
613 lines
%!PS-Adobe-1.0
%%
%% This document automatically generated by cdlabelgen
%%
%% Copyright (C) 1998 B. W. Fitzpatrick <fitz@red-bean.com>
%%
%% Author: B. W. Fitzpatrick <fitz@red-bean.com>
%% Maintainer: B. W. Fitzpatrick <fitz@red-bean.com>
%% Created: October, 1998
%% Keywords: postscript, labels
%%
%% $Id: template.ps,v 1.29 1999/06/21 19:35:16 bwf Exp $
%%
%% This program is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation; either version 2, or (at your option)
%% any later version.
%%
%% This program is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
%% GNU General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with this program; if not, you can either send email to this
%% program's maintainer or write to: The Free Software Foundation,
%% Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Reencode the font to support international characters.
%% This taken directly from GNUPlot 3.7 /term/next.trm
%% Submitted to me by Jens Clau▀en claussen@db.fmi.uni-passau.de
/reencodeISO {
dup dup findfont dup length dict begin
{ 1 index /FID ne { def }{ pop pop } ifelse } forall
/Encoding ISOLatin1Encoding def
currentdict end definefont
} def
/ISOLatin1Encoding [
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright
/parenleft/parenright/asterisk/plus/comma/minus/period/slash
/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon
/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N
/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright
/asciicircum/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m
/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/asciitilde
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/dotlessi/grave/acute/circumflex/tilde/macron/breve
/dotaccent/dieresis/.notdef/ring/cedilla/.notdef/hungarumlaut
/ogonek/caron/space/exclamdown/cent/sterling/currency/yen/brokenbar
/section/dieresis/copyright/ordfeminine/guillemotleft/logicalnot
/hyphen/registered/macron/degree/plusminus/twosuperior/threesuperior
/acute/mu/paragraph/periodcentered/cedilla/onesuperior/ordmasculine
/guillemotright/onequarter/onehalf/threequarters/questiondown
/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla
/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute
/Thorn/germandbls/agrave/aacute/acircumflex/atilde/adieresis
/aring/ae/ccedilla/egrave/eacute/ecircumflex/edieresis/igrave
/iacute/icircumflex/idieresis/eth/ntilde/ograve/oacute/ocircumflex
/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex/udieresis
/yacute/thorn/ydieresis
] def
/Helvetica reencodeISO def
/Helvetica-Bold reencodeISO def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Font related stuff
/banfont /Helvetica-Bold def
/cover_ban_size 42 def
/tray_ban_size 42 def
/bansize 42 def
/subbanfont /Helvetica-Bold def
/cover_subban_size 24 def
/tray_subban_size 24 def
/subbansize 24 def
/notefontname /Helvetica-Bold def
/notefontsize 12 def
/normalfontname /Helvetica def
/normalfontsize 10 def
/max_item_height 12 def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Constants
/print_traycard_plaque_p TOKEN_PLAQUE_P def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Dimensions
/in {72 mul } def
/tng_width .375 in def % Width of the tongue
/cap_width .25 in def % Width of the endcap
/tray_height 4.625 in def % Height of the traycard
/tray_width { 5.406 in } def % Width of the traycard
/tray_width_printable { tray_width .15 in sub } def
/cover_height { 4.72 in } def % Height of the cover
/cover_width { 4.75 in } def % Width of the cover
/cover_width_printable { cover_width .15 in sub } def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Begin Procedures
%% Auto scale the font to deal with strings that might be too long
%% Push onto the stack: font, pt size, string, max_width,
%% and we'll set the font to the right size so it isn't too wide.
/auto_scale_font {
% load up the vars from the stack into local vars.
/max_width exch 20 sub def
/the_string exch def
/pt_size exch def
/font_to_scale exch def
% Set the font that we're going to use
font_to_scale findfont [ pt_size 0 0 pt_size 0 0 ] makefont setfont
% Get the width of the string
/width_string {the_string stringwidth pop} def
/width_scale 1 def % set to 1 for width computation.
% If our string is wider than max width, get our scale ratio
width_string max_width gt
{ /width_scale {max_width width_string div} def}
if
% leave the new point size on the stack
pt_size width_scale mul
} def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Strings
/ban_string {
(TOKEN_BAN_STRING)
} def
/ban_string_padded { % pads some space onto the string we're going to use for the endcaps
% I wanted to derive this from the above string, but I couldn't get
% copy or putinterval to work right for me. Anyone who can help?
(TOKEN_BAN_STRING )
} def
/subban_string {
(TOKEN_SUBBAN_STRING)
} def
/date_today {
(TOKEN_DATE)
} def
%% Font Procedures
%% Cover
/cover_ban_font { banfont findfont
banfont bansize ban_string cover_width_printable auto_scale_font
scalefont setfont} def
banfont bansize ban_string cover_width_printable auto_scale_font
/cover_ban_size exch def
/cover_subban_font { subbanfont findfont
subbanfont subbansize subban_string cover_width_printable auto_scale_font
scalefont setfont} def
subbanfont subbansize subban_string cover_width_printable auto_scale_font
/cover_subban_size exch def
%% Tray
/tray_ban_font { banfont findfont
banfont bansize ban_string tray_width_printable auto_scale_font
scalefont setfont} def
banfont bansize ban_string tray_width_printable auto_scale_font
/tray_ban_size exch def
/tray_subban_font { subbanfont findfont
subbanfont subbansize subban_string tray_width_printable auto_scale_font
scalefont setfont} def
subbanfont subbansize subban_string tray_width_printable auto_scale_font
/tray_subban_size exch def
%% Endcaps
/notefont { notefontname findfont notefontsize scalefont setfont} def
/date_width {
notefont date_today stringwidth pop
} def
/cap_notefont {notefontname findfont
notefontname notefontsize ban_string_padded tray_height date_width sub auto_scale_font
scalefont setfont} def
/normalfont { normalfontname findfont normalfontsize scalefont setfont} def
/items [
TOKEN_ITEMS
] def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Determine how wide we want to make the plaque
/cover_plaque_width {
gsave
cover_ban_font
ban_string stringwidth pop
cover_subban_font
subban_string stringwidth pop gt
{ cover_ban_font ban_string stringwidth pop}
{ cover_subban_font subban_string stringwidth pop}
ifelse
( ) stringwidth pop 2 sub add % add a little breathing room
grestore
} def
/cover_plaque_height {
cover_ban_size cover_subban_size add
cover_ban_size 8 div cover_subban_size 6 div 2 mul add add
%9 cover_ban_size 8 div cover_subban_size 8 div 2 mul add add
} def
/tray_plaque_width {
gsave
tray_ban_font
ban_string stringwidth pop
tray_subban_font
subban_string stringwidth pop gt
{ tray_ban_font ban_string stringwidth pop}
{ tray_subban_font subban_string stringwidth pop}
ifelse
( ) stringwidth pop 2 sub add % add a little breathing room
grestore
} def
/tray_plaque_height {
tray_ban_size tray_subban_size add
tray_ban_size 8 div tray_subban_size 8 div 2 mul add add
} def
%% This is for dealing with epsfiles that do a showpage
/BEGINEPSFILE {
/EPSFsave save def
0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit [] 0 setdash
newpath
/showpage {} def
} bind def
%% This is for dealing with epsfiles that do a showpage
/ENDEPSFILE {
EPSFsave restore
} bind def
/box { % stack: width and height
/height exch def
/width exch def
0 setlinecap
0 setlinewidth
width 0 rlineto
0 height rlineto
width neg 0 rlineto
0 height neg rlineto
closepath
gsave
stroke
grestore
} def
%% Spacers
/desc 5 def
/notespacer { desc dup rmoveto } def
%% Centers something inside something else. Put a string obj and a width onto the stack first
/centerstring {
exch dup stringwidth pop 3 -1 roll exch sub 2 div 0 rmoveto show
} def
/centerobject { %stack: width within with which to center, objwidth
sub 2 div 0 rmoveto
} def
%TODO dump this
/shownormalandrepos { show_at 0 normalfontsize neg rmoveto } def
%% show a string without moving (or so they think!)
/show_at {
dup show stringwidth pop neg 0 rmoveto
} def
%% This prints the text in the endcaps
/make_endcap {
gsave
gsave
cap_notefont notespacer ban_string_padded dup show stringwidth pop
grestore
% If our ban_string_padded + subban_string is wider than the width
%of the endcap minus the width of the date, then don't print the subban_string
% width available to us
tray_height date_today stringwidth pop sub
% length of the two strings (don't use the padded string!)
cap_notefont ban_string stringwidth pop subban_string stringwidth pop add gt
{ 0 rmoveto
normalfont
0 desc rmoveto subban_string show }
if
grestore
cap_notefont date_today dup stringwidth pop tray_height exch sub desc sub desc rmoveto show
} def
%% For the plaque
/plaquepath {
plaquewidth 0 rlineto
0 plaqueheight rlineto
plaquewidth neg 0 rlineto
0 plaqueheight neg rlineto
closepath
} def
%% Draw a nice plaque with a small shadow
%% --Based on a ps-print proc from emacs
/plaque { % Stack: width and height
gsave
/plaqueheight exch def
/plaquewidth exch def
0.4 setlinewidth
% ---- fill a black rectangle (the shadow of the next one)
gsave
2 -2 rmoveto
plaquepath
gsave 0 setgray fill grestore
% ---- do the next rectangle ...
grestore
plaquepath
closepath
gsave 0.9 setgray fill grestore % filled with grey
gsave 0 setgray stroke grestore % drawn with black
grestore
} def
%% End Procedures
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% First endcap
/first_endcap {
gsave
newpath
0 0 moveto
cap_width tray_height box
cap_width 0 moveto
90 rotate
make_endcap
grestore
} def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Back of the jewel box
/tray_card {
gsave
% Draw the box
newpath
cap_width 0 moveto
gsave
tray_width tray_height box
grestore
newpath
% Move to the upper left corner of the tray_card
cap_width tray_height 5 sub moveto
% Put this in a conditional so that we can optionally *not* print
% the plaque on the traycard.
print_traycard_plaque_p 0 gt
{
gsave
% move down and start the box at the bottom of the text
0 tray_plaque_height neg rmoveto
% Center, then make the plaque
tray_width tray_plaque_width centerobject
tray_plaque_width tray_plaque_height plaque
grestore
gsave
% center and print the title
0 tray_ban_size neg rmoveto
gsave
tray_ban_font ban_string tray_width centerstring
grestore
% then subtitle
0 cover_subban_size cover_ban_size 8 div add neg rmoveto
tray_subban_font subban_string width centerstring
grestore
% Move down to a suitable position for printing the listing
0 tray_plaque_height 15 add neg rmoveto
}
if
% else
print_traycard_plaque_p 1 lt
{ 0 8 neg rmoveto }
if
% Indent
8 0 rmoveto
% Get the height of our printable space for the items
/col_height currentpoint exch pop def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% TODO It would probably be better to truncate or wrap long lines instead of scaling them.
gsave
% 0 - 22 items
/num_cols 1 def
% 23 - 54 items
items length 23 gt { /num_cols 2 def } if
% 55 - 110 items
items length 55 gt { /num_cols 3 def } if
% 110 and up
items length 110 gt { /num_cols 4 def } if
% 192 seems like a good max number of items for the back
/how_many_items items length def
how_many_items 192 gt {
% If we're printing the plaque, then we do 192
print_traycard_plaque_p 0 gt
{ /how_many_items 192 def } if
% else we do 256
print_traycard_plaque_p 1 lt
{ /how_many_items 256 def } if
} if
% figure out our font size by dividing the total printable height by
% the number of items
/line_height col_height num_cols mul how_many_items div def
/item_size line_height 1 add def
% Don't go bigger than 14 pts tho...
line_height max_item_height gt {
/line_height max_item_height def
/item_size max_item_height def
} if
% set our font
/itemsfont
{ normalfontname findfont item_size scalefont setfont} def
itemsfont
% Print the items
items {
dup
/item_string exch def
/col_width tray_width num_cols div def
% Scale down if the item is wider than the column.
/itemsfont { normalfontname findfont
normalfontname item_size item_string col_width 8 add auto_scale_font
scalefont setfont} def
itemsfont
% And show the text
show_at 0 line_height neg rmoveto
% Set the font back to normal size
/itemsfont
{ normalfontname findfont item_size scalefont setfont} def
% If we get to the bottom, move up and over!
4 currentpoint exch pop gt
{
grestore
tray_width num_cols div 0 rmoveto
gsave
% If we move past the right edge of the tray_card,
% then it's time to stop printing items.
currentpoint pop tray_width gt
{exit} if
itemsfont} if
} forall
grestore
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
grestore
} def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Second endcap
/second_endcap {
cap_width tray_width add 0 moveto
cap_width tray_height box
gsave
% Position ourselves to write in the endcap
tray_width cap_width add tray_height moveto
270 rotate
make_endcap
grestore
} def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Tongue endcap
/tongue_endcap {
cap_width tray_width add cap_width add 0 moveto
tng_width tray_height box
gsave
% Position ourselves to write in the endcap
% Same as second endcap
% tng_width cap_width sub 2 div tray_width cap_width add cap_width add add tray_height moveto
% 270 rotate
% Same as first endcap
tng_width cap_width sub 2 div tray_width cap_width 3 mul add add 0 moveto
90 rotate
make_endcap
grestore
} def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%cover
/cover {
newpath
0 cover_height 25 add moveto
gsave
cover_width cover_height box
grestore
gsave
0 cover_height 5 sub rmoveto
gsave
% move down and start the box at the bottom of the text
0 cover_plaque_height neg rmoveto
cover_width cover_plaque_width centerobject
cover_plaque_width cover_plaque_height plaque
grestore
% center and print the title, then subtitle
0 cover_ban_size
neg rmoveto
gsave
cover_ban_font ban_string cover_width centerstring
grestore
0 cover_subban_size cover_ban_size 8 div add neg rmoveto
cover_subban_font subban_string cover_width centerstring
grestore
% We're now back in the bottom left corner of the cover
% relocate to an appropriate place to put the date on the cover
notefont
cover_width date_today stringwidth pop sub 10 sub % X
cover_height tray_plaque_height 20 add sub rmoveto % Y
date_today show
} def
gsave
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% And off we go
%% Position ourselves in a reasonable place
.5 in .5 in translate
first_endcap
tray_card
second_endcap
tongue_endcap
cover
TOKEN_EPS_BOUNDS
gsave
BEGINEPSFILE
%move it to where we want to go.
cover_width bound2x bound1x sub scaleratio mul 7 add sub
tray_height 25 15 add add
translate
%adjust origin of epsfile to be 0 0
% we can automatically account for symmetrical scaling
bound1x scaleratio mul neg bound1y scaleratio mul neg translate
scaleratio dup scale
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TOKEN_COVER_EPS
ENDEPSFILE
%grestore
% Graphic on the tray_card
BEGINEPSFILE
grestore
gsave
TOKEN_TRAY_CARD_BOUNDS
%move it to where we want to go.
tray_width cap_width add bound2x bound1x sub scaleratio mul 7 add sub
5
translate
%adjust origin of epsfile to be 0 0
% we can automatically account for symmetrical scaling
bound1x scaleratio mul neg bound1y scaleratio mul neg translate
scaleratio dup scale
TOKEN_TRAY_CARD_EPS
ENDEPSFILE
grestore
% Use up a little of the whitespace on the scrap part of the paper
normalfontname findfont normalfontsize scalefont setfont
0 0 moveto tray_width cap_width 4 mul add tray_height 25 add moveto
90 rotate
gsave
(cdlabelgen, version 1.5.0, ) show
/Symbol findfont 12 scalefont setfont (\343) show
normalfontname findfont normalfontsize scalefont setfont
( 1998, 1999 B. W. Fitzpatrick <fitz@red-bean.com>) show
grestore
0 18 neg rmoveto
normalfontname findfont 8 scalefont setfont
gsave
(The latest version of cdlabelgen is available at ) show
(http://www.red-bean.com/~bwf/software/cdlabelgen/) show
grestore
0 10 neg rmoveto
(This version last updated 1999-06-22. ) show
(Contains a substantial amount of non-tobacco ingredients.) show
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
showpage